package io.ex;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import io.ex.service.SchedualServiceHi;
import io.ex.service.SchedualServiceMaya;

@SpringBootApplication
@EnableEurekaClient
@EnableDiscoveryClient
@EnableFeignClients
@RestController
public class ServiceFeignApplication {

    public static void main(String[] args) {
        SpringApplication.run( ServiceFeignApplication.class, args );
    }
    
  //编译器报错，无视。 因为这个Bean是在程序启动的时候注入的，编译器感知不到，所以报错。
    @Autowired
    SchedualServiceHi schedualServiceHi;
    @Autowired
    SchedualServiceMaya schedualServiceMaya;

    @GetMapping(value = "/hi")
    public String sayHi(String name) {
        String sayHiFromClientOne = schedualServiceHi.sayHiFromClientOne( name );
        String sayMayaFromClientOne = schedualServiceMaya.sayMayaFromClientOne( name );
		return sayHiFromClientOne + sayMayaFromClientOne;
    }
}
